<?php
function user($classid){
	$power=getdataf('power','usertable','userid',$_SESSION['userid']);
	$classname=getdataf('classname','class','classid',$classid);
?>
	<!--显示所有用户-->
	<div class"user">
		<div class="topic"><?php echo $classname; ?>的成员：</div>
		<table>
			<tr>
				<td>姓名</td>
				<td>部门</td>
				<td>职务</td>
				<td colspan="2">操作</td>
			</tr>
	<?php

	$thisuserid=getdataallfc('userid','usertable','classid',$classid);
	if($thisuserid)
	{
		
		for($i=0;$i<count($thisuserid);$i++)
		{
			$username=getdataf('username','usertable','userid',$thisuserid[$i]);
			$duty=getdataf('duty','usertable','userid',$thisuserid[$i]);
			if($classid!=0)
			{
				$dutyname=getdataf('dutyname','dutytable','duty',$duty);
				?>
			<tr>
				<td><?php echo $username; ?></td>
				<td><?php echo $classname; ?></td>
				<td><?php echo $dutyname; ?></td>
				<td>
				<?php
					echo "<input type='button' class='button' value='详细资料' onclick=\"displayuser('".$thisuserid[$i]."')\"/>";
					if($power==3)
					{
						echo "<input type='button' class='button' value='重置密码' onclick=\"getcheck('".$thisuserid[$i]."',3)\"/>"; 
						echo "<input type='button' class='button' value='删除' onclick=\"getcheck('".$thisuserid[$i]."',4)\"/>"; 	
					}
					?>
				</td>	
			</tr>
			<?php
			}
		}
	}
	?>
		</table>
	</div>

<?php
}
?>

